home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / rbsetnv1.zip / COMSUB.H < prev    next >
Text File  |  1991-01-03  |  1KB  |  45 lines

  1. /*
  2.  * comsub.h - include file for routines to perform command substitution
  3.  *              and environment variable parsing and expansion
  4.  *
  5.  * Author:    R. Brittain 4/11/90
  6.  *            This code placed in the public domain
  7.  *
  8.  */
  9.  
  10. #include <stdio.h>
  11. #include "popen.h"
  12.  
  13. #define MEMCHECK(x)        if ((x) == NULL) fatal("Out of memory",1)
  14. #define TRUE             (1)
  15. #define FALSE             (0)
  16. #define MAXARGLINE        127
  17.  
  18. #ifdef UNIXCOMPAT
  19.  #define ENV                '$'        /* character prefacing environment vars */
  20.  #define BKQ                '`'        /* character used to quote command subst */
  21.  #define EXE                '@'        /* character to preface .exe/.com commands */
  22.  #define strupr(x)            (x)        /* disable upper-casing env-vars */
  23. #else
  24.  #define ENV                '%'        /* character prefacing environment vars */
  25.  #define BKQ                '`'        /* character used to quote command subst */
  26.  #define EXE                '@'        /* character to preface .exe/.com commands */
  27. #endif
  28.  
  29. typedef struct {                /* structure to use for growing string types */
  30.     char *b;                    /* base of string */
  31.     char *p;                    /* current "head" of string */
  32.     int     len;                    /* length allocated */
  33.     int     inc;                    /* how much to grow by each time we fill up */
  34. } estring;
  35.  
  36. /* prototypes */
  37.  
  38. void     fatal(char *msg, int status);
  39. char     *endptr(char *p);
  40. char     *mfgets(FILE *);
  41. int     expand_backquotes(int *argc, char ***argv);
  42. int        rebuild_argv(int *argc, char ***argv);
  43. char     *expand_env(char *s);
  44. char     *addstring(estring *es, char *add, int count);
  45.